package com.hotel.controller;

import com.hotel.factory.BeanFactory;
import com.hotel.service.OrderDetailService;
import com.hotel.utils.WebUtils;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * Created by LinYaTing on 2018/11/28 12:27
 */
@WebServlet(name = "OrderDetailServlet", urlPatterns = "/orderDetail")
public class OrderDetailServlet extends BaseServlet {

    private Object uri;

    public Object listOrderDetail(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            //获取数据并封装数据
            String orderId = request.getParameter("orderId");
            //处理业务逻辑
            List<Map<String, Object>> orderDetail = orderDetailService.findAll(Integer.parseInt(orderId));
            //保存
            request.setAttribute("orderDetail", orderDetail);
            uri = request.getRequestDispatcher("/sys/order/order_detail.jsp");
            return uri;
    }

}
